#include "head.h" 
void calculate_individual(Node *phead_W, Node *phead_F, char *str){
	Node *p = phead_F->next;
	while(p){
		Faculty *s = (Faculty*)malloc(sizeof(Faculty));
		s = (Faculty*)p->data;
		if(strcmp(str, s->name) == 0){
			calculate(p, phead_W);
			printf("%s的月工资为：%lf\n", str, s->realmoney);
			return;
		}
		p = p->next;
	}
	printf("查无此人!"); 
	return;
}

void calculate_sector(Node *phead_W, Node *phead_F, char *str){
	Node *p = phead_F->next;
	double sum;
	while(p){
		Faculty *s = (Faculty*)malloc(sizeof(Faculty));
		s = (Faculty*)p->data;
		if(strcmp(str, s->sector) == 0){ 
			calculate(p, phead_W);
			sum += s->realmoney;
		}
		p = p->next;
	}
	printf("%s部的总月工资为：%lf", str, sum);
	return;
}

void calculate_school(Node *phead_W, Node *phead_F){
	Node *p = phead_F->next;
	double sum;
	while(p){
		Faculty *s = (Faculty*)malloc(sizeof(Faculty));
		s = (Faculty*)p->data;
		calculate(p, phead_W);
		sum += s->realmoney;
		p = p->next;
	}
	printf("全校的总月工资为：%lf", sum);
	return;
}